import React, { Component } from 'react'

type Props = {
    username: string,
    age: number,
    // changeageFn: () => void  // 函数数据类型
    changeageFn(): void
}

type State = {}

export default class Myclasschild extends Component<Props, State> {
    state = {}
    componentDidMount() {
        console.log(this);

    }
    render() {
        return (
            <div>
                <p>我是类子组件</p>
                <p>{this.props.username}--{this.props.age}</p>
                <p><button onClick={() => {
                    this.props.changeageFn()
                }}>修改年龄</button></p>
            </div>
        )
    }
}